VERSION 5.00
Begin VB.Form CoupleSummaryForm 
   Appearance      =   0  'Flat
   BackColor       =   &H80000005&
   BorderStyle     =   0  'None
   Caption         =   "Form1"
   ClientHeight    =   9000
   ClientLeft      =   0
   ClientTop       =   0
   ClientWidth     =   12000
   LinkTopic       =   "Form1"
   ScaleHeight     =   9000
   ScaleWidth      =   12000
   ShowInTaskbar   =   0   'False
   StartUpPosition =   3  'Windows Default
   WindowState     =   2  'Maximized
   Begin VB.CommandButton Clinic_Button 
      Caption         =   "Clinic Only"
      BeginProperty Font 
         Name            =   "Arial Narrow"
         Size            =   20.25
         Charset         =   0
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   735
      Left            =   840
      TabIndex        =   5
      Top             =   5760
      Width           =   2235
   End
   Begin VB.CommandButton Counsel_Button 
      Caption         =   "Counsel Only"
      BeginProperty Font 
         Name            =   "Arial Narrow"
         Size            =   20.25
         Charset         =   0
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   735
      Left            =   3240
      TabIndex        =   4
      Top             =   5760
      Visible         =   0   'False
      Width           =   2235
   End
   Begin VCT.ClientReception Client 
      Height          =   3855
      Left            =   6120
      TabIndex        =   3
      Top             =   360
      Width           =   5655
      _ExtentX        =   9975
      _ExtentY        =   6800
   End
   Begin VCT.ClientReception Partner 
      Height          =   3855
      Left            =   360
      TabIndex        =   2
      Top             =   360
      Width           =   5655
      _ExtentX        =   9975
      _ExtentY        =   6800
   End
   Begin VB.CommandButton VCT_Button 
      Caption         =   "Full VCT"
      BeginProperty Font 
         Name            =   "Arial Narrow"
         Size            =   20.25
         Charset         =   0
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   735
      Left            =   840
      TabIndex        =   1
      Top             =   4560
      Width           =   2235
   End
   Begin VB.CommandButton Cancel_Button 
      BackColor       =   &H008080FF&
      Caption         =   "Cancel"
      BeginProperty Font 
         Name            =   "Arial Narrow"
         Size            =   20.25
         Charset         =   0
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   735
      Left            =   840
      Style           =   1  'Graphical
      TabIndex        =   0
      Top             =   6960
      Width           =   2235
   End
End
Attribute VB_Name = "CoupleSummaryForm"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim SelectedPartner As Object
Dim ClientCodeString As String

Private Sub Cancel_Button_Click()
   RegMenuForm.Show
   Unload Me
End Sub

Private Sub Clinic_Button_Click()
   VISITTYP = "3"
   REFTO7 = "1"
   SaveAndFinish
End Sub

Private Sub Counsel_Button_Click()
   VISITTYP = "2"
   REFTO7 = "0"
   SaveAndFinish
End Sub

Private Sub Form_Load()
   Client.ClientSex = Sex
   Client.ReturnVisit = RETURNV
   Client.NewClientCode = NEWCODE
   Client.ClientCodeEnabled = True
   Client.ClientCode = CLIENTCO
   Client.SessionType = SESSTYPE
   Client.PartnerCode = PARTCODE
   Client.CoupleCode = COUPCODE
   Client.ShowCoupleDetails
   
   Partner.ClientSex = P_SEX
   Partner.ReturnVisit = P_RETURNV
   Partner.NewClientCode = P_NEWCODE
   Partner.ClientCodeEnabled = True
   Partner.ClientCode = P_CLIENTCO
   Partner.SessionType = P_SESSTYPE
   Partner.PartnerCode = P_PARTCODE
   Partner.CoupleCode = P_COUPCODE
   Partner.ShowCoupleDetails
   
End Sub

Private Sub Next_Button_Click()

End Sub

Private Sub SaveAndFinish()

   Dim Loc_Sex_Char As String
  
   'get the next VISITID from the database
   VISITID = Next_VISITID

   'write the data to the database
   CnUser.Open ConnectString
   Cmd.CommandText = "INSERT INTO client (VISITID, " & _
      "REGION, DISTRICT, SITE, VDATE, RETURNV, CLNTCODE, NEWCODE, SESSTYPE, COUPCODE, PARTCODE, SEX, CLRKCODE, TIMEREG, STID1, STID2, STID3, STID4, STID5, STID6, STID7, STIT1, STIT2, STIT3, STIT4, STIT5, STIT6, STIT7, CLINCOND, VISITTYP, REFTO7) " & _
      "VALUES(" & VISITID & ",'" & RegionConst & "','" & DistrictConst & "','" & SiteCodeConst & "','" & StringDate & "','" & RETURNV & "','" & CLIENTCO & "','" & NEWCODE & "','" & SESSTYPE & "','" & _
      COUPCODE & "','" & PARTCODE & "','" & Sex & "','" & UserPwd & "','" & Format(Now(), "hh:mm:ss") & "','','','','','','','','','','','','','','',0,'" & VISITTYP & " ', '" & REFTO7 & "');"
   Cmd.CommandType = adCmdText
   Cmd.ActiveConnection = CnUser
   Cmd.Execute
   CnUser.Close
      
   If ORGANIZATION = "LIGHTHOUSE" Then
      CnUser.Open ConnectString
      Cmd.CommandText = "Update client SET ADDRESS = '" & ClientAddress & "' WHERE VISITID = " & VISITID
      Cmd.CommandType = adCmdText
      Cmd.ActiveConnection = CnUser
      Cmd.Execute
      CnUser.Close
   End If
   
   
   'Update the record in the CODES table
'   CnUser.Open ConnectString
'   Cmd.CommandText = "UPDATE codes SET CLIENT_CODE = " & NewNextClientCode & ", COUPLE_Code = " & NewNextCoupleCode
'   Cmd.CommandType = adCmdText
'   Cmd.ActiveConnection = CnUser
'   Cmd.Execute
'   CnUser.Close

   'Retrieve the codes form the database
'   CnUser.Open ConnectString
'   Cmd.CommandText = "SELECT CLIENT_CODE, COUPLE_CODE FROM codes"
'   Cmd.ActiveConnection = CnUser
'   Cmd.CommandType = adCmdText
'   RsUser.Open Cmd, , adOpenStatic
'   NextClientCode = RsUser(0)
'   NextCoupleCode = RsUser(1)
'   RsUser.Close
'   CnUser.Close
      
   'Set up the VCT form for printing for the client
'   VCTFormPage1.RegionCode = "02"
'   VCTFormPage1.DistrictCode = "01"
'   VCTFormPage1.SiteCode = "001"
'   VCTFormPage1.VisitDate = VCTDate
'   If RETURNV = "0" Then
'      VCTFormPage1.ReturnVisit = "No (0)"
'   Else
'      If RETURNV = "1" Then
'         VCTFormPage1.ReturnVisit = "Yes (1)"
'      Else
'         'ERROR
'      End If
'   End If
'   VCTFormPage1.ClientCode = CLIENTCO
'   If NEWCODE = "0" Then
'      VCTFormPage1.NewClientCode = "No (0)"
'   Else
'      If NEWCODE = "1" Then
'         VCTFormPage1.NewClientCode = "Yes (1)"
'      Else
'         'ERROR
'      End If
'   End If
'   If SESSTYPE = "01" Then
'      VCTFormPage1.SessionType = "Individual (1)"
'   Else
'      If SESSTYPE = "02" Then
'         VCTFormPage1.SessionType = "Couple (2)"
'      Else
'         'ERROR
'      End If
'   End If
'   VCTFormPage1.PartnerCode = PARTCODE
'   VCTFormPage1.CoupleCode = COUPCODE
'   If SEX = "1" Then
'      VCTFormPage1.ClientSex = "Male (1)"
'   Else
'      If SEX = "2" Then
'         VCTFormPage1.ClientSex = "Female (2)"
'      Else
'         'ERROR
'      End If
'   End If
'   If DevMode = False Then
'      VCTFormPage1.PrintSheet
'      DoEvents
'      VCTFormPage2.PrintSheet
'   End If
'   DoEvents
   
   If Sex = "1" Then
      Loc_Sex_Char = "M"
   Else
      If Sex = "2" Then
         Loc_Sex_Char = "F"
      Else
         Loc_Sex_Char = "?"
      End If
   End If
   
   'print the label
   retval = PrintLabel(SiteCodeConst, OutreachCodeConst, CLIENTCO, Loc_Sex_Char)
   
   'get the next VISITID from the database
   P_VISITID = Next_VISITID
   
   'write the data to the database
   CnUser.Open ConnectString
   Cmd.CommandText = "INSERT INTO client (VISITID, " & _
      "REGION, DISTRICT, SITE, VDATE, RETURNV, CLNTCODE, NEWCODE, SESSTYPE, COUPCODE, PARTCODE, SEX, CLRKCODE, TIMEREG, STID1, STID2, STID3, STID4, STID5, STID6, STID7, STIT1, STIT2, STIT3, STIT4, STIT5, STIT6, STIT7, CLINCOND, VISITTYP, REFTO7) " & _
      "VALUES(" & P_VISITID & ",'" & RegionConst & "','" & DistrictConst & "','" & SiteCodeConst & "','" & StringDate & "','" & P_RETURNV & "','" & P_CLIENTCO & "','" & P_NEWCODE & "','" & P_SESSTYPE & "','" & _
      P_COUPCODE & "','" & P_PARTCODE & "','" & P_SEX & "','" & UserPwd & "','" & Format(Now(), "hh:mm:ss") & "','','','','','','','','','','','','','','',0,'" & VISITTYP & " ', '" & REFTO7 & "');"
   Cmd.CommandType = adCmdText
   Cmd.ActiveConnection = CnUser
   Cmd.Execute
   CnUser.Close
   
   If ORGANIZATION = "LIGHTHOUSE" Then
      CnUser.Open ConnectString
      Cmd.CommandText = "Update client SET ADDRESS = '" & PartnerAddress & "' WHERE VISITID = " & P_VISITID
      Cmd.CommandType = adCmdText
      Cmd.ActiveConnection = CnUser
      Cmd.Execute
      CnUser.Close
   End If
   
            
   'Set up the VCT form for printing for the Partner
'   VCTFormPage1.RegionCode = "02"
'   VCTFormPage1.DistrictCode = "01"
'   VCTFormPage1.SiteCode = "001"
'   VCTFormPage1.VisitDate = VCTDate
'   If P_RETURNV = "0" Then
'      VCTFormPage1.ReturnVisit = "No (0)"
'   Else
'      If P_RETURNV = "1" Then
'         VCTFormPage1.ReturnVisit = "Yes (1)"
'      Else
'         'ERROR
'      End If
'   End If
'   VCTFormPage1.ClientCode = P_CLIENTCO
'   If P_NEWCODE = "0" Then
'      VCTFormPage1.NewClientCode = "No (0)"
'   Else
'      If P_NEWCODE = "1" Then
'         VCTFormPage1.NewClientCode = "Yes (1)"
'      Else
'         'ERROR
'      End If
'   End If
'   If P_SESSTYPE = "01" Then
'      VCTFormPage1.SessionType = "Individual (1)"
'   Else
'      If P_SESSTYPE = "02" Then
'         VCTFormPage1.SessionType = "Couple (2)"
'      Else
'         'ERROR
'      End If
'   End If
'   VCTFormPage1.PartnerCode = P_PARTCODE
'   VCTFormPage1.CoupleCode = P_COUPCODE
'   If P_SEX = "1" Then
'      VCTFormPage1.ClientSex = "Male (1)"
'   Else
'      If P_SEX = "2" Then
'         VCTFormPage1.ClientSex = "Female (2)"
'      Else
'         'ERROR
'      End If
'   End If
'
'   If DevMode = False Then
'      VCTFormPage1.PrintSheet
'      DoEvents
'      VCTFormPage2.PrintSheet
'   End If
      
   If P_SEX = "1" Then
      Loc_Sex_Char = "M"
   Else
      If P_SEX = "2" Then
         Loc_Sex_Char = "F"
      Else
         Loc_Sex_Char = "?"
      End If
   End If
   
   'print the label
   retval = PrintLabel(SiteCodeConst, OutreachCodeConst, P_CLIENTCO, Loc_Sex_Char)
      
   RegMenuForm.Show
   Unload Me
End Sub

'Private Sub ReturnVisit1_SelectionMade()
'   P_RETURNV = ReturnVisit1.ClientReturnVisit
'   Partner.ReturnVisit = P_RETURNV
'   If P_RETURNV = "0" Then
'      P_NEWCODE = "1"
'      Client.NewClientCode = P_NEWCODE
'      P_CLIENTCO = NewNextClientCode
'      NewNextClientCode = NewNextClientCode + 1
'   End If
'   Next_Button.Enabled = True
'End Sub

Private Sub VCT_Button_Click()
   VISITTYP = "1" 'full VCT
   REFTO7 = "0"
   SaveAndFinish
End Sub
